Skip to content

Use standard key behavior in array_column() #5487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Apr 29, 2020

I noticed that array_column() implements its own bespoke treatment of array keys, that does not match how PHP generally handles array keys. This PR changes it to use a standard API instead.

Of course, there is a backwards compatibilty break here, e.g. people could be relying on objects getting cast to string instead of throwing.

@nikic
Copy link
Member Author

nikic commented Apr 29, 2020

cc @ramsey as the original author of this functionality. The RFC https://wiki.php.net/rfc/array_column does not specify a specific behavior.

@ramsey
Copy link
Member

ramsey commented Apr 29, 2020

I don't recall why I implemented a separate treatment for keys, but it makes sense to me to use the standard API instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants